/**
 * Created by BIANBAIN
 */
import FontAwesome from 'react-native-vector-icons/FontAwesome'
import {OIcon} from './oneIconFont'
import React, {Component} from 'react'
import PropTypes from 'prop-types'

const iconMap = {
  'fontAwesome': FontAwesome,
  'oneIcon': OIcon
}

class Icon extends Component {

  render() {
    const {name, size, color, style} = this.props

    let CustomIcon = iconMap['oneIcon']
    if (!CustomIcon) throw new Error('没有找到匹配的font库，请review代码！')
    return (
      <CustomIcon name={name} size={size} color={color} style={style}/>
    )
  }
}

Icon.propTypes = {
  name: PropTypes.string.isRequired,
  size: PropTypes.number.isRequired,
  color: PropTypes.string.isRequired
}

export {Icon}